function f = extractFeature(type, data, varargin)
    optnum = size(varargin,2);
    switch type
        case 'sum'
            f = sum(data);
        case 'mean'
            f = mean(data);
        case 'moment'
            if optnum < 1
                error('extractFeature:argChk','order should be specified.');
            end
            order = varargin{1};
            f = moment(data, order);
        case 'var'
            f = var(data);
        case 'std'
            f = std(data);
        otherwise
            error('extractFeature:argChk','Unknown type of feature.');
    end
end
